package ru.amse.tsyganov.jumleditor.graphicaleditor.activity;

import ru.amse.tsyganov.jumleditor.graphicaleditor.GraphicalEditor;
import ru.amse.tsyganov.jumleditor.graphicaleditor.common.AddEdgeMode;
import ru.amse.tsyganov.jumleditor.model.activity.Transition;
import ru.amse.tsyganov.jumleditor.model.common.Edge;
import ru.amse.tsyganov.jumleditor.model.common.GraphModel;
import ru.amse.tsyganov.jumleditor.model.common.StateVertex;
import ru.amse.tsyganov.jumleditor.view.ConnectionPoint;
import ru.amse.tsyganov.jumleditor.view.activity.TransitionView;
import ru.amse.tsyganov.jumleditor.view.common.EdgeView;
import ru.amse.tsyganov.jumleditor.view.common.GraphView;

public class AddTransitionMode extends AddEdgeMode {

	public AddTransitionMode(GraphicalEditor graphicalEditor) {
		super(graphicalEditor);
	}

	@Override
	public EdgeView<? extends Edge> createEdgeView(
			StateVertex sourceStateVertex, StateVertex targetStateVertex,
			ConnectionPoint sourceConnectionPoint,
			ConnectionPoint targetConnectionPoint,
			GraphView<? extends GraphModel> graph) {
		
		Transition transition = new Transition(
				sourceStateVertex, 
				targetStateVertex);
		
		EdgeView<? extends Edge> transitionView = 
			new TransitionView<Transition>(transition, 
					graph,
					sourceConnectionPoint,
					targetConnectionPoint);
		
		return transitionView;
	}

	@Override
	public boolean isClosureAllowed() {
		return false;
	}

	@Override
	public boolean isDublicateAllowed() {
		return false;
	}

}
